mui.init()

mui.plusReady(function(){
    document.querySelector('#feedback_btn').addEventListener('tap',function(){
        var wd = plus.nativeUI.showWaiting();
        var api_host = plus.storage.getItem('HOST_URL');
        var content = $("#content").val();
        if(content == ''){
        	wd.close();
        	mui.toast('请输入您的反馈意见');
        	return false;
        }else{
			mui.getJSON("../../../manifest.json",null,function(data){
				mui.ajax({
					url:api_host+'/api/cusservice/feedback/add',
					data:{
						"content":content,
						'versionNum': data.version.code,
						'model': plus.device.model, //设备的型号
						'version':plus.os.version,//系统版本信息
						'version_name':plus.os.name,//系统名称
						'vendor':plus.device.vendor, //设备的生产厂商
					},
					dataType:'json',
					type:'post',
					headers:{'User-Token':plus.storage.getItem('UserToken')},
					timeout:1000,
					success:function(msg){
						wd.close();
						mui.toast(msg.msg,{ duration:'3000', type:'div'});
					},
					error:function(xhr,type,errorThrown){
						mui.toast(msg.msg,{ duration:'1000', type:'div'});
					}
				});
			})

        }
    })
})